package edu.pku.sei.transformation.editor.controller.editparts.link;

import org.eclipse.draw2d.IFigure;
import org.eclipse.swt.SWT;

import edu.pku.sei.modeler.model.structure.MetaShapeElement;
import edu.pku.sei.transformation.editor.model.goal.GoalRelationship;
import edu.pku.sei.transformation.editor.views.figures.ConnectionFigure;

public class GoalRelationshipEditpart extends TransformationLinkEditPart {

	public GoalRelationshipEditpart(MetaShapeElement conn) {
		super(conn);
	}

	@Override
	protected IFigure createFigure() {
		GoalRelationship model = (GoalRelationship) getLink().getModelElement();
		ConnectionFigure figure = new ConnectionFigure(SWT.LINE_DASH);
		figure.setTargetDecoration(ConnectionFigure.ARROW);
		if (model.getType() == GoalRelationship.TYPE_DEPEND)
			figure.setLabel("<<depend>>",
					ConnectionFigure.CONNECTION_FIGURE_MIDDLE);
		else if (model.getType() == GoalRelationship.TYPE_INCLUDE)
			figure.setLabel("<<include>>",
					ConnectionFigure.CONNECTION_FIGURE_MIDDLE);
		return figure;
	}

}
